﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;

namespace SoftwareConsulting.BI11.Studio.InternalServices
{
    /// <summary>
    /// Класс отладочных печатей
    /// </summary>
    public static class Trace
    {
        private static string _currentBlockName = string.Empty;

        public static void StartBlock(string blockName)
        {
            _currentBlockName = blockName;
//#if DEBUG
            Message("---" + Application.ProductName + " trace begin");
            Message("---" + blockName);
            Debug.Indent();
//#endif
        }

        public static void Message(string messageText)
        {
//#if DEBUG
            Debug.WriteLine(messageText);
//#endif
        }

        public static void EndBlock()
        {
            Assert.FailIf(string.IsNullOrEmpty(_currentBlockName), Assert.Id.Assert00001);
//#if DEBUG
            Debug.Unindent();
            Message("---" + _currentBlockName);
            Message("--- trace end");
//#endif
            _currentBlockName = string.Empty;            
        }
    }
}
